﻿using System;
using System.Collections.Generic;
using System.Text;
using JRBase;
using Microsoft.Xna.Framework;

namespace JRTestGame
{
    public class MapHandler : IMapHandler
    {
        private Map map;

        public void Initialize(Map map)
        {
            this.map = map;
        }

        public void Update(GameTime gameTime)
        {
            Player player = (Player)map.Player;
            if (!player.Hit)
            {
                foreach (Actor enemy in map.CollidedEnemies)
                {
                    player.Hit = true;
                    player.X = (int)player.lastPos.X;
                    player.Y = (int)player.lastPos.Y;
                }        
            }
            map.CollidedEnemies.Clear();
        }
    }
}
